package recite.word.client.controller;

import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiModelProperty;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import recite.word.client.service.IBookService;
import recite.word.mybatis.auto.model.Book;
import recite.word.service.base.common.enums.DeleteEnum;
import recite.word.service.base.common.response.ResponseResult;

import java.util.Arrays;
import java.util.List;

/**
 * @program: recite-word-back
 * @description:
 * @author: Mr.lin
 * @create: 2023-01-27 15:22
 **/

@RestController
@RequestMapping("/client/book")
@Api(tags = "客户端【书籍】controller")
public class BookController {
	@Autowired
	private IBookService bookService;
	
	@ApiModelProperty("获取全部书籍")
	@PostMapping("/getAll")
	public ResponseResult<List<Book>> getAll(){
		List<Book> ans = bookService.list(Wrappers.<Book>lambdaQuery()
				.eq(Book::getDeleteStatus, DeleteEnum.NOT_DELETED.getCode()));
		return ResponseResult.success(ans);
	}
}
